package frame;

import temp.*;
import utils.BoolList;

public class MipsFrame extends Frame {
	static private int word_size = 4;
	public Access allocLocal(boolean escape){		
		if(escape){
			Access frame_alloc = new InFrame(word_size);
			return frame_alloc;
		}else{
			Access reg_alloc = new InReg(new Temp());
			return reg_alloc;
		}
	}
	
	public Frame newFrame(Label n, BoolList f) {
		name = n;		
		BoolList boolean_iterator = f;
		AccessList formals_iterator = formals;
		while(boolean_iterator.tail != null){
			formals_iterator.head = allocLocal(boolean_iterator.head);
			formals_iterator = formals_iterator.tail;
			boolean_iterator = boolean_iterator.tail;			
		}
		
		return null;
	}

	@Override
	public Temp FP() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int wordSize() {
		return word_size;
	}
}
